package com.tanhua.server.service;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.api.SettingsApi;
import com.tanhua.dubbo.pojo.Settings;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SettingsService {

    @DubboReference(version = "1.0.0")
    private SettingsApi settingsApi;

    /**
     * 根据用户id查询配置
     *
     * @param userId
     * @return
     */
    public Settings querySettings(Long userId) {
        return this.settingsApi.querySettings(userId);
    }

    /**
     * 更新设置
     *
     * @param userId
     * @param likeNotification
     * @param pinglunNotification
     * @param gonggaoNotification
     */
    public void updateNotifications(Long userId, Boolean likeNotification, Boolean pinglunNotification, Boolean gonggaoNotification) {
        this.settingsApi.updateNotifications(userId, likeNotification, pinglunNotification, gonggaoNotification);
    }
}
